#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>
#include <QTableWidgetItem>
#include <QMdiSubWindow>
#include <QFileDialog>
#include <QMessageBox>
#include "binview.h"
#include "action.h"
#include <QDebug>
#include <QMap>
#include <QMdiSubWindow>
#include <types.h>
#include <QActionGroup>
#include <QPushButton>
#include <QToolButton>
#include <QAction>
#include <QMenu>
#include <QProcess>
#include "mdisubwindow.h"
#include "dialogabout.h"
#include "dialogaddbookmark.h"
#include "dialogsearch.h"
#include "dialoggoto.h"

namespace Ui {
class MainWindow;
}

class MainWindow : public QMainWindow
{
    Q_OBJECT

public:
    explicit MainWindow(QWidget *parent = 0);
    ~MainWindow();

public slots:
    void on_actionExit_triggered();

    void on_actionOpen_triggered();

    void on_actionClose_triggered();

    void actionCloseByPath(QString path);

    void on_actionRecent_hovered();

    void on_actionBookmark_triggered();

    void on_actionFind_triggered();

    void on_actionGoto_triggered();

    void on_actionAbout_triggered();

    void onActionFilesTriggered(QString name);

    void on_actionClose_All_triggered();

    void on_actionClose_All_2_triggered();

    void onAGAddrFormatTriggered();
    void onAGFirstFormatTriggered();
    void onAGSecFormatTriggered();
    void onAGFirstEndianTriggered();
    void onAGSecEndianTriggered();

private slots:
    void on_actionAdd_Bookmark_triggered();

    void on_actionGitee_triggered();

private:
    Ui::MainWindow *ui;

    DISPLAY_FORMAT_EN enAddrFormat;
    DISPLAY_FORMAT_EN enFirstFormat;
    DISPLAY_FORMAT_EN enSecFormat;
    DISPLAY_ENDIAN_EN enFirstEndian;
    DISPLAY_ENDIAN_EN enSecEndian;

    QActionGroup *agAddrFormat;
    QActionGroup *agFirstFormat;
    QActionGroup *agSecFormat;
    QActionGroup *agFirstEndian;
    QActionGroup *agSecEndian;

    QAction *bntOpen;
    QAction *bntClose;
    QAction *bntCloseAll;
    QAction *bntSearch;
    QAction *bntBookmark;
    QAction *bntBookAdd;

    QToolButton *bntAddrFormat;
    QToolButton *bntFirstFormat;
    QToolButton *bntSecFormat;

    QString defalutPath;
    QMap<QString, MdiSubWindow *> swMap;
    QMap<QString, BinView *> bvMap;
    QMap<QString, Action *> actionMap;
};

#endif // MAINWINDOW_H
